package com.qf;

import com.qf.model.Device;
import jdk.nashorn.internal.runtime.JSONFunctions;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class test4 {

    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private StringRedisTemplate stringRedisTemplate;

    @Test
    public void demo01(){
        Device device = new Device();
        device.setId(1111);
        device.setPrice(11155.11);
        device.setDeviceName("打印机");
        device.setCompany("浙江杭州印打有限公司");
        device.setType("印黑设备");

        redisTemplate.opsForValue().set("device"+device.getId(),device);

        Device o = (Device) redisTemplate.opsForValue().get("device" + device.getId());
        System.out.println(o);

    }


}
